<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no">
  <title>{$tdk['title']}</title>
  <meta name="description" content="{$tdk['description']}">
  <meta name="keywords" content="{$tdk['keywords']}">
  <meta name="author" content="alonez"/>
  <link rel="shortcut icon" href="https://ujia-img.oss-cn-shenzhen.aliyuncs.com/changehome/favicon.ico">
  <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://res.bestyoujia.com/common/third/swiper/6.3.5/swiper-bundle.min.css">
  <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
  <script src="https://ujia-res.oss-cn-shenzhen.aliyuncs.com/changehome/assets/js/layer-v3.1.1/layer.js"></script>
  <style>

    body {
      margin: 0 auto;
      max-width: 520px;
      overflow-x: hidden;
      position: relative;
    }

    .container-fluid {
      background-size: cover;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      padding: 0;
    }

    .mx-auto {
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    img {
      width: 100%;
    }

    .text-center {
      text-align: center;
    }

    input:focus, select:focus, button:focus {
      outline: none;
    }

    .mask-container {
      position: fixed;
      z-index: 1;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background: rgba(0, 0, 0, .7);
      display: none;
      overflow: hidden;
      min-height: 100vh;
    }

    .d-flex {
      display: flex;
    }

    .flex-column {
      flex-direction: column;
    }

    .justify-content-center {
      justify-content: center;
    }

    .align-items-center {
      align-items: center;
    }

    .wx-input {
      margin-top: .25rem;
      width: 5.6rem;
      height: .6rem;
      background: #FFFFFF;
      border: 1px solid #CCCCCC;
      font-size: .24rem;
      padding-left: .1rem;
      border-radius: 8px;
    }

    select {
      width: 4.4rem;
      background: #FFFFFF;
      border: 1px solid #CCCCCC;
      height: .6rem;
      font-size: .24rem;
      display: flex;
      color: #333;
      padding: 0 .1rem;
      border-radius: 8px;
    }

    #wx-submit {
      border: 0;
      margin-top: .4rem;
      color: #fff;
      width: 5.6rem;
      height: .65rem;
      font-size: .25rem;
      background: #1C2857;
      border-radius: 8px;
    }

    #wx-submit:active {
      opacity: .8;
    }
  </style>
</head>
<script>
  var _hmt = _hmt || [];
  (function () {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?40c4a0b79991b779265eef34e4be9d02";
    const s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
</script>
  <body>
  <section class="container-fluid">
    <div class="d-flex flex-column align-items-center">
      <img src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/致美微信产品稿_01.png" alt="">
      <img src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/致美微信产品稿_02.png" alt="">
      <img src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/致美微信产品稿_03.png" alt="">
      <img src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/致美微信产品稿_04.png" alt="">
      <img src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/致美微信产品稿_05.png" alt="">
      <img src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/致美微信产品稿_06.png" alt="">
      <img src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/致美微信产品稿_07.png" alt="">
      <img src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/致美微信产品稿_08.png" alt="">
      <div class="d-flex flex-column justify-content-center align-items-center" style="padding: 1.03rem .75rem; width: 7.5rem; background: url('https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/bg.png')">
        <div class="d-flex flex-column justify-content-center align-items-center" style="background: #fff; width: 6rem; padding: .4rem .2rem .6rem">
          <div style="font-size: .36rem; color: #C37437; font-weight: bold">预约报名</div>
          <div style="display: flex">
            <input class="wx-input" id="wx-customer" placeholder="请输入您的姓名" >
          </div>
          <div style="display: flex">
            <input class="wx-input" id="wx-mobile" type="tel" placeholder="请输入您的手机号" >
          </div>
          <div class="align-items-center" style="display: flex; justify-content: space-between; width: 5.6rem; margin-top: .25rem">
            <div style="font-size: .24rem">致电时间</div>
            <select id="wx-time">
              <option value="立即联系" selected>立即联系</option>
              <option value="上午（09:00-12:00）">上午（09:00-12:00）</option>
              <option value="中午（12:00-14:00）">中午（12:00-14:00）</option>
              <option value="下午（14:00-18:00）">下午（14:00-18:00）</option>
              <option value="晚上（18:00-20:00）">晚上（18:00-20:00）</option>
            </select>
          </div>
          <button id="wx-submit">立即预约 0元报价</button>
        </div>
      </div>
    </div>
  </section>
  <section class="mask-container">
    <div class="d-flex align-items-center justify-content-center" style="width: 100%; height: 100%">
      <div style="display: flex; flex-direction: column; justify-content: center; align-items: center">
        <div class="d-flex flex-column align-items-center" style="width: 6rem; background: #fff; padding: .48rem .2rem">
          <img style="width: 1.61rem; height: 1.28rem" src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/yy.png" alt="">
          <div style="font-size: .36rem; font-weight: bold;color: #1C2857; margin-top: .4rem">恭喜您，预约成功</div>
          <div style="font-size: .24rem;color: #333333; margin-top: .3rem">稍后会有工作人员联系您详细讲解，请留意来电！</div>
          <img style="width: 4.8rem; height: 2.91rem; margin-top: .5rem" src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/yh.png" alt="">
        </div>
        <img id="wx-close" style="width: .5rem; height: .5rem; margin-top: .4rem" src="https://res.bestyoujia.com/web/ZMYJ/wxlanding202106/RT.png" alt="">
      </div>
    </div>
  </section>
</body>
<script src="https://res.bestyoujia.com/common/assets/js/appointment.js"></script>
<script src="https://res.bestyoujia.com/common/third/swiper/6.3.5/swiper-bundle.min.js"></script>
<script src="https://res.bestyoujia.com/web/DGZJ/assets/js/mobile-common.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script src="https://res.bestyoujia.com/common/assets/js/wxShare.js"></script>
  <script>
    (function (n, e) {
      const t = n.documentElement, i = "orientationchange" in window ? "orientationchange" : "resize", d = function () {
        let n = t.clientWidth;
        if(n > 520) {
          n = 520;
        }
        n && (t.style.fontSize = n / 7.5 + "px")
      };
      n.addEventListener && (e.addEventListener(i, d, !1));
      n.addEventListener && n.addEventListener("DOMContentLoaded", d, !1);
    })(document, window);

    const swiper = new Swiper('.swiper-container', {
      pagination: {
        el: '.swiper-pagination',
        clickable: true
      },
      autoplay: {
        delay: 3000,
        stopOnLastSlide: false,
        disableOnInteraction: true,
      },
      paginationElement: 'li',
      paginationClickable: true,
      loop: true,
      autoplayDisableOnInteraction: false
    });

    function validMobile(number) {
      let isMob = /^1\d{10}$/;
      if (number === "") {
        return 2;
      }
      return isMob.test(number) ? 1 : 0;
    }

    $('#wx-close').on('click', function () {
      $('.mask-container').hide();
    });

    $('#wx-submit').on("click", function () {
      window.page_position = '微信报名';
      const customer = $('#wx-customer').val();
      if(!customer) {
        showWarnTips('请输入您的姓名', '#wx-customer');
        return;
      }
      const mobile = $('#wx-mobile').val();
      const mobile_result = validMobile(mobile);
      switch (mobile_result) {
        case 0:
          showWarnTips('请输入正确的手机号', '#wx-mobile');
          break;
        case 1:
          const date = $('#wx-time').val();
          const data = {customer, mobile, remark: `致电时间:${date}`};
          doAppointment(data, function (res) {
            $('#wx-customer').val("");
            $('#wx-mobile').val("");
            console.log('onAppointmentSuccess', res);
            const {data = ''} = res;
            if (data) {
              buryingPoint('APPOINTMENT', data);
              // layer.msg('预约成功，我们稍后会给您致电', {
              //   icon: 6,
              //   time: 1200
              // });
              $('.mask-container').show();
            }
          }, function (err) {
            console.log('onAppointmentError', err);
            $('#wx-customer').val("");
            $('#wx-mobile').val("");
            layer.msg('预约失败', {
              icon: 5,
              time: 1200
            });
          });
          break;
        case 2:
          showWarnTips('请输入手机号', '#wx-mobile');
          break;
      }
    });

    function showWarnTips(msg, dom) {
      layer.tips(msg, dom, {
        tips: [1, '#fa8c16'],
        time: 2000
      });
    }

    Array.prototype.remove = function(val) {
      const index = this.indexOf(val);
      if (index > -1) {
        this.splice(index, 1);
      }
    };
  </script>
</html>